package com.example.shiwuyouproject.ui.fragment.my.activity.fragment

import com.example.shiwuyouproject.base.BaseVmFragment
import com.example.shiwuyouproject.databinding.FragmentMyinvitationBinding
import com.example.shiwuyouproject.ui.fragment.my.activity.adapter.MyInvitationAdapter
import com.example.shiwuyouproject.ui.fragment.my.activity.bean.MyInvitationBean
import com.example.shiwuyouproject.ui.fragment.my.activity.viewmodel.MyInvitationFragmentViewModel

class MyInvitationFragment :
    BaseVmFragment<FragmentMyinvitationBinding, MyInvitationFragmentViewModel>() {
    override fun viewModelClass(): Class<MyInvitationFragmentViewModel> =
        MyInvitationFragmentViewModel::class.java

    override fun getViewBinding(): FragmentMyinvitationBinding {
        return FragmentMyinvitationBinding.inflate(layoutInflater)
    }

    private var type = ""
    private var myInvitationAdapter: MyInvitationAdapter? = null
    override fun initView() {
        type = arguments?.getString("type").toString()
        myInvitationAdapter = MyInvitationAdapter()
        mBinding.myinvitationRecyclerView.adapter = myInvitationAdapter
        val myData:MutableList<MyInvitationBean> =ArrayList()
        for (i in 0..10){
            myData.add(MyInvitationBean())
        }
        myInvitationAdapter?.setNewData(myData)

    }

    override fun setListener() {
        mBinding.myinvitationSmartRefreshLayout.setOnRefreshListener {
            mBinding.myinvitationSmartRefreshLayout.finishRefresh(2000)
        }
        mBinding.myinvitationSmartRefreshLayout.setOnLoadMoreListener {
            mBinding.myinvitationSmartRefreshLayout.finishLoadMore(2000)
        }
    }
}